import { NgModule } from '@angular/core';
import { Routes, RouterModule, ExtraOptions } from '@angular/router';
import { AuthGuardService } from './@core/services/auth-guard-service.guard';
import { LoginComponent } from './@shared/components/login/login.component';
import { RegisterComponent } from './@shared/components/register/register.component';
import { OtherLoginComponent } from './@shared/components/other-login/other-login.component';
import { CanActivateGuard } from './@core/services/can-load-service.guard';
import { AppComponent } from './app.component';

const routes: Routes = [
  {
    path: 'pages',
    loadChildren: () =>
      import('./pages/pages.module').then((m) => m.PagesModule),
    canActivate: [AuthGuardService, CanActivateGuard]
  },
  {
    path: 'opterator-tasks',
    loadChildren: () =>
      import('./opterator-tasks/opterator-tasks.module').then((m) => m.OpteratorTasksModule),
    canActivate: [AuthGuardService],
  },
  {
    path: 'kanban',
    loadChildren: () =>
      import('./kanban/kanban.module').then((m) => m.KanbanModule),
    canActivate: [AuthGuardService],
  },
  {
    path: 'login',
    component: LoginComponent,
  },
  {
    path: 'register',
    component: RegisterComponent,
  },
  {
    path: 'other-login',
    component: OtherLoginComponent
  },
  {
    path: '',
    component:AppComponent,
    canActivate: [CanActivateGuard],
  },
];

@NgModule({
  imports: [RouterModule.forRoot(routes)],
  exports: [RouterModule],
})
export class AppRoutingModule { }
